package com.yykj.hospital.server.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.yykj.common.vo.ResultVO;
import com.yykj.hospital.client.dto.HospitalSettingOnlineDTO;
import com.yykj.hospital.server.form.HospitalOnlineSettingEditForm;
import com.yykj.hospital.server.model.entity.HospitalSettingAppointDialog;
import com.yykj.hospital.server.model.entity.HospitalSettingAppointment;
import com.yykj.hospital.server.model.entity.HospitalSettingCheck;
import com.yykj.hospital.server.model.entity.HospitalSettingOnlineOther;
import com.yykj.hospital.server.service.HospitalSettingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/backstage/hospital")
@Api(tags = {"服务设置"})
@SuppressWarnings("unchecked")
public class HospitalServiceSettingController {
    @GetMapping("/online/setting/list")
    @ApiOperation("在线问诊-问诊设置--列表")
    public ResultVO<HospitalSettingOnlineDTO> listHospitalOnlineSetting(@RequestParam(name = "hospitalId") Integer hospitalId){
        return ResultVO.success(hospitalSettingService.listHospitalOnlineSetting(hospitalId));
    }

    @PostMapping("/online/setting/edit")
    @ApiOperation("在线问诊-问诊设置--修改")
    public ResultVO<HospitalSettingOnlineDTO> editHospitalOnlineSetting(@RequestBody HospitalOnlineSettingEditForm form){
        return ResultVO.success(hospitalSettingService.editHospitalOnlineSetting(form));
    }

    @GetMapping("/online/other/setting/info/{hospitalId}")
    @ApiOperation("在线问诊-其它设置--查看")
    public ResultVO<HospitalSettingOnlineOther> viewHospitalSettingOnlineOther(@PathVariable(name = "hospitalId") Integer hospitalId){
        return ResultVO.success(hospitalSettingService.viewHospitalSettingOnlineOther(hospitalId));
    }

    @PostMapping("/online/other/setting/edit")
    @ApiOperation("在线问诊-其它设置--修改")
    @ApiOperationSupport(ignoreParameters = {"addTime","modifyTime"})
    public ResultVO<HospitalSettingOnlineOther> editHospitalSettingOnlineOther(@RequestBody HospitalSettingOnlineOther form){
        return ResultVO.success(hospitalSettingService.editHospitalSettingOnlineOther(form));
    }


    @GetMapping("/online/check/setting/info/{hospitalId}")
    @ApiOperation("检查检验--查看")
    public ResultVO<HospitalSettingCheck> viewHospitalCheckSetting(@PathVariable(name = "hospitalId") Integer hospitalId){
        return ResultVO.success(hospitalSettingService.viewHospitalCheckSetting(hospitalId));
    }

    @PostMapping("/online/check/setting/edit")
    @ApiOperation("检查检验--修改")
    public ResultVO<HospitalSettingCheck> editHospitalCheckSetting(@RequestBody HospitalSettingCheck form){
        return ResultVO.success(hospitalSettingService.editHospitalCheckSetting(form));
    }


    @GetMapping("/appointment/setting/info/{hospitalId}")
    @ApiOperation("预约挂号--查看")
    public ResultVO<HospitalSettingAppointment> viewHospitalSettingAppointment(@PathVariable(name = "hospitalId") Integer hospitalId){
        return ResultVO.success(hospitalSettingService.viewHospitalSettingAppointment(hospitalId));
    }

    @PostMapping("/appointment/setting/setting/edit")
    @ApiOperation("预约挂号--修改")
    public ResultVO<HospitalSettingAppointment> editHospitalSettingAppointment(@RequestBody HospitalSettingAppointment form){
        return ResultVO.success(hospitalSettingService.editHospitalSettingAppointment(form));
    }

    @ApiOperation("预约挂号 -- 预约需知 -- 查看")
    @GetMapping("/appointment/dialog/{hospitalId}")
    public ResultVO<HospitalSettingAppointDialog> viewHospitalSettingAppointDialog(@PathVariable Integer hospitalId){
        return ResultVO.success(hospitalSettingService.viewHospitalSettingAppointDialog(hospitalId));
    }

    @ApiOperation("预约挂号 -- 预约需知 -- 修改")
    @PutMapping("/appointment/dialog/edit")
    public ResultVO<HospitalSettingAppointDialog> editHospitalSettingAppointDialog(@RequestBody HospitalSettingAppointDialog form){
        return ResultVO.success(hospitalSettingService.editHospitalSettingAppointDialog(form));
    }

    private HospitalSettingService hospitalSettingService;

    @Autowired
    public void setHospitalSettingService(HospitalSettingService hospitalSettingService) {
        this.hospitalSettingService = hospitalSettingService;
    }
}
